<template>
	<view class="register">
		<view class="container-box">
			<scroll-view scroll-y="true" style="height: 100%;">
				<view>
					<view class="flex-box border-bottom-box form-item">
						<view>手机号：</view>
						<view class="auto-box">
							<input placeholder-class="placeholder-box" maxlength="11" placeholder="请输入手机号" type="tel"
								v-model="userInfo.mobile" />
						</view>
					</view>
					<view class="flex-box border-bottom-box form-item">
						<view>头像上传：</view>
						<view @tap.stop="handleSelect" class="auto-box end-box flex-box">
							<view class="flex-box select-photo">
								<view>+</view>
							</view>
						</view>
					</view>
					<view class="flex-box border-bottom-box form-item">
						<view>昵称：</view>
						<view class="auto-box">
							<input placeholder-class="placeholder-box" placeholder="请输入昵称" type="text"
								v-model="userInfo.nickname" />
						</view>
					</view>
					<view class="flex-box border-bottom-box form-item">
						<view>密码设置：</view>
						<view class="auto-box">
							<input placeholder-class="placeholder-box" maxlength="11" placeholder="请输入你的密码" type="safe-password"
								v-model="userInfo.password" />
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
		<view class="white-bg">
			<view class="basic-box">
				<view class="flex-box checked-container-box" @tap.stop="_=>isCheck=!isCheck">
					<view :class="['checked-box',isCheck?'select-active':'default-select']">
						<view>√</view>
					</view>
					<view class="tips-box">
						<text>已阅读并同意</text>
						<text class="tips-active">《这里是协议名，可点击跳转至协议详情页》</text>
					</view>
				</view>
			</view>
			<view class="flex-box register-box">
				<view class="btn-box" @tap.stop="handleRegister">注册</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	// 是否选中协议
	const isCheck = ref(true)
	// 表单信息
	const userInfo = ref({
		nickname: '',
		mobile: '',
		avatar: '',
		password: ''
	})
	/**
	 * @description 选择头像
	 */
	function handleSelect(){}
	/**
	 * @description 注册
	 */
	function handleRegister(){
		console.log(userInfo.value);
	}
</script>

<style lang="scss" scoped>
	.register {
		display: flex;
		flex-direction: column;
		height: 100%;

		.container-box {
			flex: 1;
			padding: 32rpx;
			background-color: #fff;
			overflow: hidden;
		}

		.tips-box {
			font-size: 32rpx;
			color: rgba(128, 128, 128, 1);
		}

		.tips-active {
			color: rgba(42, 130, 228, 1);
		}

		.checked-box {
			padding: 4rpx 11rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 24rpx;
			color: #fff;
			margin-right: 16rpx;
		}

		.select-active {
			background-color: rgba(67, 207, 124, 1);
		}

		.checked-container-box {
			align-items: flex-start;
		}

		.register-box {
			justify-content: center;
			margin: 32rpx;

			.btn-box {
				padding: 22rpx 122rpx;
				border-radius: 10rpx;
				background: rgba(67, 207, 124, 1);
				font-size: 32rpx;
				font-weight: 500;
				color: white;
			}
		}

		.form-item {
			padding: 20rpx 0;
			font-size: 26rpx;
			color: #000;
			text-align: right;
		}

		.auto-box {
			flex: 1;
		}

		.placeholder-box {
			color: rgba(144, 144, 144);
			font-size: 24rpx;
		}
		.select-photo{
			justify-content: center;
			width: 70rpx;
			height: 70rpx;
			border-radius: 100%;
			background-color: rgb(241,241,241);
			color: #fff;
			font-size: 40rpx;
			font-weight: 700;
		}
		.default-select{
			background-color: rgb(241, 241, 241);
			color:rgba(241, 241, 241);
		}
	}
</style>